######################################################################
#Replication file for "The Impact of China's AIIB on the World Bank"
#Authors: Jing Qian, James Vreeland, Jianzhi Zhao
#Codes to replicate Table F2
######################################################################
rm(list = ls())

#Other packages used
library(stargazer)

#Setwd
setwd("C:/Users/qianj/Dropbox (Princeton)/AIIB_WB_Replication")

#Load data
load("data/data_main.RData")

#########################
#Produce Table F2
#########################
#---------------
#(1) Paranmeter
#---------------
#Variables
vars = c("aiib_founder_2016",
         "hard_project_count_all",
         "hard_project_count_s1",
         "hard_project_count_s1_b",
         "soft_project_count_all",
         "soft_project_count_s1",
         "soft_project_count_s1_b",
         "gdppc_log_lag",
         "population_log_lag",
         "election_either_lag",
         "fdi_gdp_lag",
         "debt_gni_lag",
         "oda_gni_lag",
         "polity2_lag",
         "unsc_lag",
         "IdealPointDistance_lag")
#Labels
var.labels = c("AIIB Founder × Post 2016",
               "World Bank Project Count, Hard",
               "World Bank Project Count, Hard (b)",
               "World Bank Project Count, Hard (c)",
               "World Bank Project Count, Soft",
               "World Bank Project Count, Soft (b)",
               "World Bank Project Count, Soft (c)",
               "GDP per capita (log)",
               "Population (log)",
               "Election",
               "FDI (\\% GDP)",
               "Debt service (\\% GNI)",
               "ODA received (\\% GNI)",
               "Polity",
               "Temporary UNSC member",
               "UNGA Voting (Ideal Point distance from US)")

#---------------
#(2) Produce table
#---------------
stargazer(df.main %>%
            subset(., select = vars),
          omit.summary.stat = c("p25", "p75"),
          covariate.labels = var.labels,
          title = "Summary Statistics",
          type = "text")